import time 
def read2list(file):
    file = open(file, "r")
    l = file.readlines()
    return(l)

def b_sort(a):
    for i in range (len(a)-1):
        for j in range(len(a)-2,i-1,-1):
            if a[j] > a[j+1]:
                a[i], a[i+1] = a[i+1], a[i]


m2=read2list("m2_reverse.txt")
ts2 = time.time()
b_sort(m2)
tf2 = time.time()
print("m2_reverse.txt", (tf2 - ts2)*1000,"millisec.")

m1=read2list("m1_sorted.txt")
ts = time.time()
b_sort(m1)
tf = time.time()
print("m1_sorted.txt", (tf - ts)*1000,"millisec.")

m3=read2list("m3_shuffle.txt")
ts3 = time.time()
b_sort(m3)
tf3 = time.time()
print("m3_shuffle.txt", (tf3 - ts3)*1000,"millisec.")
